Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if ref'd resource is selected before favoring state #10108

Merged
merged 3 commits into from
May 8, 2024

Conversation

jtcohen6
Copy link
Contributor

@jtcohen6 jtcohen6 commented May 8, 2024

resolves #10107

Problem

Previous behavior of --favor-state + --defer, when selecting multiple resources that build on top of each other, was to favor state for only unselected resources.

The recent deferral refactors (#9040 + #9199) implicitly changed this behavior, by favoring state always.

Solution

Check to see whether a referenced node is selected (using selected_resources global) before favoring state (defer_relation).

I have added a test case that:

  • passes on 1.7.latest (86df655)
  • fails on current main
  • passes again with the change in this PR (cb8c702)

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
  • This PR includes type annotations for new and modified functions

@jtcohen6 jtcohen6 requested a review from a team as a code owner May 8, 2024 13:17
@jtcohen6 jtcohen6 requested a review from MichelleArk May 8, 2024 13:17
@cla-bot cla-bot bot added the cla:yes label May 8, 2024
Copy link

codecov bot commented May 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.19%. Comparing base (fe9e39d) to head (2794250).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10108      +/-   ##
==========================================
- Coverage   88.23%   88.19%   -0.05%     
==========================================
  Files         181      181              
  Lines       22770    22770              
==========================================
- Hits        20092    20081      -11     
- Misses       2678     2689      +11     
Flag Coverage Δ
integration 85.50% <ø> (-0.12%) ⬇️
unit 62.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

# User has explicitly opted to prefer defer_relation for unselected resources
(
self.config.args.favor_state
and target_model.unique_id not in selected_resources.SELECTED_RESOURCES
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a global (ew), and has been for a while:

@jtcohen6 jtcohen6 merged commit 84cc540 into main May 8, 2024
75 checks passed
@jtcohen6 jtcohen6 deleted the jerco/fix-10107 branch May 8, 2024 18:01
github-actions bot pushed a commit that referenced this pull request May 8, 2024
* Add test case

* Check if ref'd resource is selected before favoring state

* Add changie

(cherry picked from commit 84cc540)
jtcohen6 added a commit that referenced this pull request May 9, 2024
…10114)

* Add test case

* Check if ref'd resource is selected before favoring state

* Add changie

(cherry picked from commit 84cc540)

Co-authored-by: Jeremy Cohen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Restore v1.7 behavior for --defer + --favor-state when selecting interdependent resources
2 participants